{% extends "BackendBundle::backend.html.twig" %}

{% block title "Administración de Hoteles" %}

{% set vars = {'ruta' : app.request.attributes.get('_route')} %}

{% block header %}

    {% include "BackendBundle::topmenu.html.twig" with vars %}

{% endblock %}

{% block left %}

    {% include "HotelBundle:Cadena:menuleft.html.twig" with vars %}

{% endblock %}

{% block content %}
    <div class="span9">
        <h2>Listado de hoteles</h2>

        {% if app.session.hasFlash('success') %}
            <div class="flash-notice alert alert-success">
                <h4 class="alert-heading">Ok!</h4>                     
                {{ app.session.flash('success') }}
            </div>
        {% endif %}

        {% if app.session.hasFlash('error') %}
            <div class="flash-notice alert alert-error">
                <h4 class="alert-heading">Error!</h4>                        
                {{ app.session.flash('error') }}
            </div>
        {% endif %}

        {% if app.session.hasFlash('info') %}
            <div class="flash-notice alert alert-info">
                <h4 class="alert-heading">Info!</h4>
                <p>{{ app.session.flash('info') }}</p>
            </div>
        {% endif %} 
        
        <fieldset>
            <legend>Hotel Principal</legend>
            
            <div class="well">
                <table class="table">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>{{ "Nombre"|trans }}</th>
                            <th>{{ "Web"|trans }}</th>
                            <th>{{ "Email"|trans }}Mail</th>
                            <th>{{ "Publicado"|trans }}</th>
                            <th></th>
                        </tr>
                    </thead>
                    {% for hotelpa in hotelpare %}
                    <tbody>
                        <tr>
                            <td style="vertical-align:middle">{{hotelpa.id}}</td>
                            <td style="vertical-align:middle">{{hotelpa.hotelname}}</td>
                            <td style="vertical-align:middle">{{hotelpa.hotelweb}}</td>
                            <td style="vertical-align:middle">{{hotelpa.hotelmail}}</td>
                            <td style="vertical-align:middle">

                                {% if hotelpa.published == 1 %}

                                    {% image '@HotelBundle/Resources/public/images/publicat.png' %}
                                        <img src="{{ asset_url }}" />
                                    {% endimage %}

                                {% endif %}

                            </td>
                            <td>
                                <a href="{{ path('ContentBundle_homepage_hotel', {'idhotel': hotelpa.id}) }}" class="btn btn-small btn-primary" title="{{ "Contenido"|trans }}"><i class="icon-plus icon-white">&nbsp;</i></a> 
                                <a href="{{ path("HotelBundle_edit", {'idhotel': hotelpa.id}) }}" class="btn btn-small" title="{{ "Editar"|trans }}"><i class="icon-pencil">&nbsp;</i></a>
                            </td>
                        </tr>
                    </tbody>
                    {% endfor %}
                </table>   
            </div>
            
        </fieldset>

        <fieldset>
            
            <legend>Hoteles</legend>
            
            <div class="row-fluid">
                <div class="span7"></div>
                <div class="span5 ">
                    <form class="form-search">
                        <input type="text" class="input-medium search-query">
                        <button type="submit" class="btn">{{ "Search"|trans }}</button>
                    </form>
                </div>
            </div>            
        
            <div class="well">
                
                <table class="table">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>{{ "Nombre"|trans }}</th>
                            <th>{{ "Web"|trans }}</th>
                            <th>{{ "Email"|trans }}Mail</th>
                            <th>{{ "Publicado"|trans }}</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>

                    {% for hotel in pager.getResults %}

                        <tr>
                            <td style="vertical-align:middle">{{hotel.id}}</td>
                            <td style="vertical-align:middle">{{hotel.hotelname}}</td>
                            <td style="vertical-align:middle">{{hotel.hotelweb}}</td>
                            <td style="vertical-align:middle">{{hotel.hotelmail}}</td>
                            <td style="vertical-align:middle">

                                {% if hotel.published == 1 %}

                                    {% image '@HotelBundle/Resources/public/images/publicat.png' %}
                                        <a href="{{ path("HotelBundle_publish", {'idhotel': hotel.id}) }}"><img src="{{ asset_url }}" /></a>
                                    {% endimage %}

                                {% else %}

                                    {% image '@HotelBundle/Resources/public/images/no-publicat.png' %}
                                        <a href="{{ path("HotelBundle_publish", {'idhotel': hotel.id}) }}"><img src="{{ asset_url }}" /></a>
                                    {% endimage %}

                                {% endif %}

                            </td>
                            <td>
                                <a href="{{ path('ContentBundle_homepage_hotel', {'idhotel': hotel.id}) }}" class="btn btn-primary" title="{{ "Contenido"|trans }}"><i class="icon-plus icon-white">&nbsp;</i></a> 
                                <a href="{{ path("HotelBundle_edit", {'idhotel': hotel.id}) }}" class="btn" title="{{ "Editar"|trans }}"><i class="icon-pencil">&nbsp;</i></a> 
                                <a href="{{ path("HotelBundle_borrar", {'idhotel': hotel.id}) }}" class="btn btn-danger" title="{{ "Borrar"|trans }}"><i class="icon-trash icon-white">&nbsp;</i></a>
                            </td>
                        </tr>

                    {% else %}
                        <tr>
                            <td colspan="6">{{ "No hay resultados"|trans }}</d>
                        </tr>
                    {% endfor %}

                    </tbody>
                </table>
                
            </div>

            {% if pager.isPaginable %}
                {{ paginate(pager, 'HotelBundle_homepage_paginacio') }}
            {% endif %}
            
        </fieldset>

    </div>

{% endblock %}
